<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Gradle 构建系统深度指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
            border: 1px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 12px;
            overflow: hidden;
            position: relative;
        }
        
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 40px;
            background: #2d2d2d;
            border-bottom: 1px solid #3e3e3e;
        }
        
        .code-block pre {
            padding: 60px 24px 24px;
            overflow-x: auto;
            margin: 0;
        }
        
        .code-lang {
            position: absolute;
            top: 10px;
            right: 20px;
            color: #858585;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        
        .section-number {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 50%;
            font-weight: 700;
            margin-right: 16px;
            flex-shrink: 0;
        }
        
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 20px 24px;
            border-radius: 12px;
            margin: 20px 0;
            position: relative;
            overflow: hidden;
        }
        
        .highlight-box::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: pulse 3s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(0.8); opacity: 0.5; }
            50% { transform: scale(1.2); opacity: 0.8; }
        }
        
        .mermaid {
            background: white;
            padding: 40px;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            margin: 40px 0;
        }
        
        .feature-icon {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            margin-bottom: 20px;
        }
        
        h1, h2, h3 {
            font-family: 'Noto Serif SC', serif;
        }
        
        .drop-cap {
            float: left;
            font-size: 4em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0 0;
            font-weight: 700;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-family: 'Noto Serif SC', serif;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white">
        <div class="container mx-auto px-6 py-20">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-6">
                    <i class="fas fa-cogs mr-4"></i>Gradle 构建系统深度指南
                </h1>
                <p class="text-xl md:text-2xl opacity-90 leading-relaxed">
                    掌握现代化构建工具的核心技术，提升项目构建效率与质量
                </p>
                <div class="mt-10 flex justify-center space-x-6">
                    <div class="text-center">
                        <div class="text-3xl font-bold">5</div>
                        <div class="text-sm opacity-75">核心模块</div>
                    </div>
                    <div class="text-center">
                        <div class="text-3xl font-bold">20+</div>
                        <div class="text-sm opacity-75">实战技巧</div>
                    </div>
                    <div class="text-center">
                        <div class="text-3xl font-bold">∞</div>
                        <div class="text-sm opacity-75">性能提升</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="container mx-auto px-6 py-12">
        <!-- Knowledge Map -->
        <div class="mb-16">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 text-center">
                <i class="fas fa-sitemap mr-3 text-purple-600"></i>知识体系导图
            </h2>
            <div class="mermaid">
                graph TD
                    A[Gradle 构建系统] --> B[依赖管理]
                    A --> C[Task 开发]
                    A --> D[多模块项目]
                    A --> E[插件系统]
                    A --> F[性能优化]
                    
                    B --> B1[依赖类型]
                    B --> B2[配置策略]
                    B --> B3[冲突解决]
                    
                    C --> C1[自定义Task]
                    C --> C2[依赖控制]
                    C --> C3[增量构建]
                    
                    D --> D1[项目结构]
                    D --> D2[配置管理]
                    D --> D3[公共配置]
                    
                    E --> E1[官方插件]
                    E --> E2[社区插件]
                    E --> E3[自定义插件]
                    
                    F --> F1[配置优化]
                    F --> F2[构建分析]
                    F --> F3[缓存策略]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                    style B fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style D fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style E fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style F fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </div>

        <!-- Section 1: 依赖管理深入 -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12 card-hover">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 flex items-center">
                <span class="section-number">1</span>
                依赖管理深入
            </h2>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-xl">
                    <div class="feature-icon">
                        <i class="fas fa-cube"></i>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-800 mb-3">依赖类型详解</h3>
                    <p class="text-gray-600">
                        <span class="drop-cap">理</span>解不同依赖类型的使用场景，合理选择 implementation、compileOnly、runtimeOnly 等配置，优化项目依赖结构。
                    </p>
                </div>
                
                <div class="bg-gradient-to-br from-blue-50 to-indigo-50 p-6 rounded-xl">
                    <div class="feature-icon" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">
                        <i class="fas fa-cog"></i>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-800 mb-3">依赖配置策略</h3>
                    <p class="text-gray-600">掌握现代化的依赖配置最佳实践，避免依赖泄露，使用 BOM 管理版本，确保构建的稳定性。</p>
                </div>
                
                <div class="bg-gradient-to-br from-green-50 to-teal-50 p-6 rounded-xl">
                    <div class="feature-icon" style="background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);">
                        <i class="fas fa-shield-alt"></i>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-800 mb-3">依赖冲突解决</h3>
                    <p class="text-gray-600">学习多种冲突解决方案，包括强制版本、排除依赖、依赖锁定等技术，保证项目依赖的一致性。</p>
                </div>
            </div>
            
            <div class="code-block">
                <span class="code-lang">Groovy</span>
                <pre><code>dependencies {
    implementation 'org.apache.commons:commons-lang3:3.12.0' // 编译+运行时
    compileOnly 'javax.servlet:servlet-api:4.0.1'         // 仅编译
    runtimeOnly 'mysql:mysql-connector-java:8.0.28'       // 仅运行时
    testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' // 测试
    annotationProcessor 'org.projectlombok:lombok:1.18.24' // 注解处理
}</code></pre>
            </div>
            
            <div class="highlight-box mt-6">
                <h4 class="text-lg font-semibold mb-2">
                    <i class="fas fa-lightbulb mr-2"></i>最佳实践提示
                </h4>
                <p class="relative z-10">使用 implementation 代替已废弃的 compile 配置，避免不必要的依赖传递，提升构建性能。对于库开发场景，合理使用 api 配置暴露必要的依赖。</p>
            </div>
        </div>

        <!-- Section 2: 自定义Task开发 -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12 card-hover">
            <h2 class="text-3xl font-bold text-gray-800 mb-8 flex items-center">
                <span class="section-number">2</span>
                自定义Task开发
            </h2>
            
            <div class="mb-8">
                <h3 class="text-2xl font-semibold text-gray-700 mb-4">
                    <i class="fas fa-file-code mr-2 text-purple-600"></i>创建文件处理Task
                </h3>
                <p class="text-gray-600 mb-4 leading-relaxed">
                    Task 是 Gradle 构建的核心单元。通过自定义 Task，可以实现项目特定的构建逻辑，提高开发效率。
                </p>
                
                <div class="code-block">
                    <span class="code-lang">Groovy</span>
                    <pre><code>tasks.register('processFiles', Copy) {
    from 'src/raw'
    into 'build/processed'
    include '*.txt'
    rename { String filename ->
        filename.replace('.txt', '_processed.txt')
    }
    doLast {
        println "已处理 ${inputs.files.size()} 个文件"
    }
}</code></pre>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-6 mt-8">
                <div class="bg-gradient-to-r from-purple-100 to-pink-100 p-6 rounded-xl">
                    <h4 class="text-xl font-semibold text-gray-800 mb-3">
                        <i class="fas fa-link mr-2"></i>Task依赖控制
                    </h4>
                    <div class="code-block mt-4">
                        <span class="code-lang">Groovy</span>
                        <pre><code>task deployLocal {
    dependsOn build
    finalizedBy cleanCache
    mustRunAfter test
    
    doLast {
        println "部署